home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / windows4 / pcproj.zip / RESDIALO.CLS < prev    next >
Text File  |  1988-09-15  |  1KB  |  47 lines

  1. /* Edit a resource.
  2.    This class descends from class ActivDialog and inherits all
  3.    of its data and behaviors.  The edit item is therefore called
  4.    activity, even though it is really a resource.
  5. */!!
  6.  
  7. inherit(ActivDialog, #ResDialog, nil, 2, nil)!!
  8.  
  9. now(ResDialogClass)!!
  10.  
  11. now(ResDialog)!!
  12.  
  13. /* Update the edit item (activity) after Ok was pressed.
  14.    Adjust a zero max value to be nil. */
  15. Def  update(self | max)
  16. {
  17.   max := asDec(getItemText(self,MAX));
  18.   if max == 0
  19.     max := nil;
  20.   endif;
  21.     
  22.   setValues(activity, tuple(
  23.       getItemText(self, NAME),
  24.       max,
  25.       asDec(getItemText(self, FC)),
  26.       asDec(getItemText(self, VC))));
  27. } !!
  28.  
  29. /* Return the resource ID that should be used with this
  30.    dialog box. */
  31. Def  res(self)
  32. {
  33.   ^RES_BOX;
  34. }!!
  35.  
  36. /* Initialize the dialog so all fields have the correct values. */
  37. Def initDialog(self, wp, lp)
  38. {
  39.   setText(self, makeCaption(activity));
  40.   setItemText(self, NAME, asString(getName(activity)));
  41.   setItemText(self, MAX, asString(getMaximum(activity)));
  42.   setItemText(self, FC, asString(getFixedCost(activity)));
  43.   setItemText(self, VC, asString(getVariableCost(activity)));
  44. }
  45. !!
  46.  
  47.